-
Notifications
You must be signed in to change notification settings - Fork 17
Support offical MCP Gem as a Backend #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Owner
Author
|
This will need to be updated when OAuth 2.1 support is merged but that's fine. This is still not quiet ready yet |
… docs and references to adapters being in +1.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Official MCP SDK Support with Adapter Pattern
Overview
This PR introduces a major architectural refactor that adds support for the official Ruby MCP SDK while maintaining full backward compatibility. The gem now uses an adapter pattern that allows users to choose between the native full-featured implementation or the official Anthropic-maintained SDK.
What's New
🎛️ Dual SDK Support (v0.8.0+)
Users can now choose their MCP implementation:
:ruby_llmadapter (default) - Native full-featured implementation with all advanced MCP features:mcp_sdkadapter (new) - Official Anthropic-maintained SDK with core MCP features🏗️ Adapter Architecture
Introduced a flexible adapter system that:
BaseAdapter) for all MCP implementationsKey Changes
New Files & Architecture
Adapter System:
lib/ruby_llm/mcp/adapters/base_adapter.rb- Base adapter interfacelib/ruby_llm/mcp/adapters/ruby_llm_adapter.rb- Native implementation adapterlib/ruby_llm/mcp/adapters/mcp_sdk_adapter.rb- Official SDK adapterNative Implementation Reorganization:
lib/ruby_llm/mcp/native/namespacenative/client.rb,native/transport.rb, andnative/protocol.rbEnhanced Configuration
config.default_adapter = :ruby_llmadapter: :mcp_sdkDocumentation
New comprehensive Adapters Guide with:
Updated README with adapter selection guidance
Enhanced configuration documentation
Feature Comparison
Testing
spec/ruby_llm/mcp/adapters/mcp_sdk_sse_spec.rbspec/ruby_llm/mcp/native/transport_spec.rbspec/ruby_llm/mcp/native/transports/*.rbspec/support/adapter_test_helpers.rbBackward Compatibility
✅ Fully backward compatible - existing code continues to work without changes:
:ruby_llm(maintains current behavior)Usage Examples
Using the Native Adapter (Default)
Using the Official SDK Adapter
Mixed Adapter Usage
Dependencies
mcpgem (>= 0.4) - only required when using:mcp_sdkadapterMigration Path
For users upgrading from v0.7.x:
gem 'mcp'to use official SDK adapterTesting Checklist
Review Focus Areas